package cn.tqfeiyang.smartadmin.commons.toolbox;

import org.springframework.context.ApplicationContext;

import java.util.Arrays;

/**
 * 环境工具类
 *
 * @author tqfeiyang
 * @since 2024/8/22 10:44
 */
public class EnvironmentUtils {

    /**
     * 是否是开发环境？
     *
     * @return 如果是开发环境，返回 true
     */
    public static boolean isDevelopment() {
        return Arrays.stream(ContextUtils.getActiveProfiles()).anyMatch(profile ->
                "dev".equalsIgnoreCase(profile) || "test".equalsIgnoreCase(profile));
    }
}
